
// LibvcformView.cpp : implementation of the CLibvcformView class
//

#include "stdafx.h"
// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail
// and search filter handlers and allows sharing of document code with that project.
#ifndef SHARED_HANDLERS
#include "Libvcform.h"
#endif

#include "LibvcformDoc.h"
#include "LibvcformView.h"

#include "Alog.h"
#include "test.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CLibvcformView

IMPLEMENT_DYNCREATE(CLibvcformView, CFormView)

BEGIN_MESSAGE_MAP(CLibvcformView, CFormView)
	ON_WM_CONTEXTMENU()
	ON_WM_RBUTTONUP()
	ON_BN_CLICKED(IDC_BUTTON1, &CLibvcformView::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &CLibvcformView::OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON3, &CLibvcformView::OnBnClickedButton3)
END_MESSAGE_MAP()

// CLibvcformView construction/destruction

CLibvcformView::CLibvcformView()
	: CFormView(CLibvcformView::IDD)
{
	// TODO: add construction code here

}

CLibvcformView::~CLibvcformView()
{
}

void CLibvcformView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
}

BOOL CLibvcformView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CFormView::PreCreateWindow(cs);
}

void CLibvcformView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

void CLibvcformView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
	ClientToScreen(&point);
	OnContextMenu(this, point);
}

void CLibvcformView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
	theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}


// CLibvcformView diagnostics

#ifdef _DEBUG
void CLibvcformView::AssertValid() const
{
	CFormView::AssertValid();
}

void CLibvcformView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CLibvcformDoc* CLibvcformView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLibvcformDoc)));
	return (CLibvcformDoc*)m_pDocument;
}
#endif //_DEBUG


// CLibvcformView message handlers


void CLibvcformView::OnBnClickedButton1()
{
	string name = "hello";
	Alog::out("->%s\r\n", name.c_str());
}


void CLibvcformView::OnBnClickedButton2()
{
	gtest->astart();
}


void CLibvcformView::OnBnClickedButton3()
{
	gtest->astop();
}
